package sparksqls.datatransfer

import org.apache.spark.sql.SparkSession


object WithHive {
  private val warehouseLocation = "hdfs://localhost:9000/spark-warehouse"
  private val spark: SparkSession = SparkSession.builder()
    .appName("load data with hive")
    .master("local")
    .config("spark.sql.warehouse.dir", warehouseLocation)
    .enableHiveSupport
    .getOrCreate

  import spark.implicits._
  import spark.sql

  case class Record(key: Int, value: String)

  def main(args: Array[String]): Unit = {
    spark.sql("select * from sparktest.student").show()
  }
}
